import React, { Component } from 'react'

import Header from './components/Header'
import Lists from './components/Lists'

import './App.css'

export default class App extends Component {
    // 初始状态
    state = { 
        users:[],
        isFirst:true,
        isLoading:false,
        err:'',
    }

    // 传递给Header 一个函数接受Header组件传递的参数
    updateAppState = (usersObj)=>{
        //设置users
        this.setState(usersObj)
    }

    render() {
        return (
            <div className="container_wrap">
               <Header updateAppState={ this.updateAppState } />
               <Lists { ...this.state } /> 
            </div>
        )
    }
}
